Skip to content

ci(triage): use pull_request_target so labeler can write on fork PRs#2850

Merged
setchy merged 2 commits intomainfrom
review-pr-2845-v1
May 8, 2026
Merged

ci(triage): use pull_request_target so labeler can write on fork PRs#2850
setchy merged 2 commits intomainfrom
review-pr-2845-v1

Conversation

@afonsojramos
Copy link
Copy Markdown
Member

@afonsojramos afonsojramos commented May 7, 2026

Summary

Switches the Triage workflow trigger from pull_request back to pull_request_target so multi-labeler and action-semantic-pull-request can write labels and post a commit status on PRs from forks (e.g. #2845). Under pull_request, GitHub forces GITHUB_TOKEN to read-only for fork PRs, regardless of the workflow's declared permissions:, which is why the labeler check has been failing.

Why this is OK (and reverting #2763 here is acceptable)

#2763 deliberately moved this file to pull_request to clear zizmor's dangerous-triggers audit. That audit's load-bearing concern is future drift — someone later adds a run: step or an unpinned uses:, and the privileged context becomes RCE without anyone noticing.

In our case the practical control is review: every change to this file goes through PR review by maintainers who have write access, and the workflow itself is structurally minimal — no actions/checkout, no run: steps, only SHA-pinned actions that read PR metadata via the GitHub API. None of zizmor's listed vectors (argument injection, env injection, file relinking) have a surface here without one of those building blocks being added, and adding them requires explicit maintainer approval.

The trigger now carries an inline # zizmor: ignore[dangerous-triggers] directive with the reasoning above written directly into the workflow, so the exception is self-documenting and zizmor's audit stays clean. Verified locally: zizmor .github/workflows/triage.ymlNo findings to report.

Test plan

  • Zizmor run passes
  • On the next fork PR, the Auto-label PR check succeeds and labels are applied

@setchy
Copy link
Copy Markdown
Member

setchy commented May 7, 2026

This was our workflow config prior to #2763 where we addressed some feedback from zimzor / actionlint

@setchy
Copy link
Copy Markdown
Member

setchy commented May 7, 2026

https://docs.zizmor.sh/audits/#dangerous-triggers

Many online resources suggest that pull_request_target and other dangerous triggers can be used securely by ensuring that the PR's code is not executed, but this is not true: an attacker can often find ways to execute code in the context of the target repository, even if the workflow doesn't explicitly run any code from the PR. Common vectors for this include argument injection (e.g. with xargs), environment injection (e.g. LD_PRELOAD), and local file inclusion (e.g. relinking files to the runner's credentials file or similar).

@afonsojramos
Copy link
Copy Markdown
Member Author

Ah, I see 🤔 I'll look at what the best alternative is. Because otherwise external PRs just don't work, which defeats the purpose: #2845

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@afonsojramos
Copy link
Copy Markdown
Member Author

Okay, so after a brief investigation, it seems the goal of zizmor’s dangerous-triggers audit here is to warn against future drift — i.e. someone later adding a run: step or unpinned uses: and the privileged context silently becoming an RCE surface — rather than flagging the current file as exploitable. In our case that drift can’t land without a maintainer-approved diff, and the workflow today has no checkout, no run:, and only SHA-pinned actions reading PR metadata via the API. Pushed a follow-up that adds an inline # zizmor: ignore[dangerous-triggers] with that reasoning written directly above the trigger so the exception is self-documenting.

@setchy setchy merged commit b4d34b4 into main May 8, 2026
14 checks passed
@setchy setchy deleted the review-pr-2845-v1 branch May 8, 2026 12:41
@github-actions github-actions Bot added this to the Release 7.0.0 milestone May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants